package shan.rpc.example.consumer;

import shan.rpc.example.common.model.User;
import shan.rpc.example.common.service.UserService;
import shan.rpc.yurpc.config.RpcConfig;
import shan.rpc.yurpc.proxy.ServiceProxyFactory;
import shan.rpc.yurpc.utils.ConfigUtils;

public class ConsumerExample {

    public static void main(String[] args) {
//        RpcConfig rpc= ConfigUtils.loadConfig(RpcConfig.class,"rpc");
//        System.out.println(rpc);
        UserService userService= ServiceProxyFactory.getProxy(UserService.class);
        User user=new User();
        user.setName("yupi");
        //调用
        User newUser=userService.getUser(user);
        if(newUser!=null){
            System.out.println(newUser.getName());
        }else{
            System.out.println("user==null");
        }
        short number = userService.getNumber();
        System.out.println(number);

    }
}
